//
//  PageScrollViewController.m
//  VirtualViewDemo
//
//  Created by xiaerfei on 2018/12/27.
//  Copyright © 2018 tmall. All rights reserved.
//

#import "PageScrollViewController.h"
#import <VirtualView/VVViewContainer.h>
#import <VirtualView/VVTemplateManager.h>

@interface PageScrollViewController ()<VirtualViewDelegate>
@property (nonatomic, strong) VVViewContainer *container;
@end

@implementation PageScrollViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.container.delegate = self;
    if (![[VVTemplateManager sharedManager].loadedTypes containsObject:@"PageItem"]) {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"PageItem" ofType:@"out"];
        [[VVTemplateManager sharedManager] loadTemplateFile:path forType:nil];
    }
    if (![[VVTemplateManager sharedManager].loadedTypes containsObject:@"FinanceList"]) {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"FinanceList" ofType:@"out"];
        [[VVTemplateManager sharedManager] loadTemplateFile:path forType:nil];
    }
    
    CGRect rect = self.view.frame;
//    rect.origin.y = 120;
    self.container.frame = rect;
    self.container.backgroundColor = [UIColor lightGrayColor];
}

- (NSDictionary *)params
{
    return @{
             @"template" : @{@"type":@"FinanceList",
                             @"styles":@{
                                     @"orientation":@"H",
                                     @"items":@[
                                             @{
                                                 @"type":@"NImage",
                                                 @"layoutWidth":@"match_parent"
                                               },
                                             
                                             ]
                                     }
                             },
             @"type" : @"PageScroll",
             @"dataStyle" : @{@"orientation":@"H"},
             @"data":@[
                     @{
                         @"type" : @"FinanceList",
                         @"text": @"固定期限 | 2年期",
                         @"rate":@"11.32%",
                         @"desc":@"每日加息最高5%",
                         @"content":@"立即转入>",
                         @"imageSrc":@"https://teststable-ms.stg.1qianbao.com/v6/images/2018/8/9/zzzz1533807818254.png"
                         
                         },
                     @{
                         @"type" : @"FinanceList",
                         @"text": @"活期理财 | 3个月",
                         @"rate":@"22.32%",
                         @"desc":@"每日加息最高8%",
                         @"content":@"立即转入>",
                         @"imageSrc":@"https://teststable-ms.stg.1qianbao.com/v6/images/2018/8/9/zzzz1533807818254.png"
                         
                         },
                     @{
                         @"type" : @"FinanceList",
                         @"text": @"活期理财 | 3个月",
                         @"rate":@"33.32%",
                         @"desc":@"每日加息最高8%",
                         @"content":@"立即转入>",
                         @"imageSrc":@"https://teststable-ms.stg.1qianbao.com/v6/images/2018/8/9/zzzz1533807818254.png"
                         
                         },
                     @{
                         @"type" : @"FinanceList",
                         @"text": @"活期理财 | 3个月",
                         @"rate":@"44.32%",
                         @"desc":@"每日加息最高8%",
                         @"content":@"立即转入>",
                         @"imageSrc":@"https://teststable-ms.stg.1qianbao.com/v6/images/2018/8/9/zzzz1533807818254.png"
                         
                         },
                     @{
                         @"type" : @"FinanceList",
                         @"text": @"活期理财 | 3个月",
                         @"rate":@"55.32%",
                         @"desc":@"每日加息最高8%",
                         @"content":@"立即转入>",
                         @"imageSrc":@"https://teststable-ms.stg.1qianbao.com/v6/images/2018/8/9/zzzz1533807818254.png"
                         
                         },
                     ]
             };
}



@end
